package com.bw.wxy.mvp.model.entity;

import android.os.Parcel;
import android.os.Parcelable;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Index;
import org.greenrobot.greendao.annotation.Generated;

@Entity
public class UserEntity implements Parcelable{
    @Id(autoincrement = true)
    private Long _id;
    @Index(unique = true)
    public int user_id;
    public int user_phone;
    public String user_pwd;
    public String user_name;
    public String user_sex;
    public String user_img;
    public int user_integral;
    @Generated(hash = 1731249417)
    public UserEntity(Long _id, int user_id, int user_phone, String user_pwd,
            String user_name, String user_sex, String user_img, int user_integral) {
        this._id = _id;
        this.user_id = user_id;
        this.user_phone = user_phone;
        this.user_pwd = user_pwd;
        this.user_name = user_name;
        this.user_sex = user_sex;
        this.user_img = user_img;
        this.user_integral = user_integral;
    }



    @Generated(hash = 1433178141)
    public UserEntity() {
    }

    protected UserEntity(Parcel in) {
        if (in.readByte() == 0) {
            _id = null;
        } else {
            _id = in.readLong();
        }
        user_id = in.readInt();
        user_phone = in.readInt();
        user_pwd = in.readString();
        user_name = in.readString();
        user_sex = in.readString();
        user_img = in.readString();
        user_integral = in.readInt();
    }

    public static final Creator<UserEntity> CREATOR = new Creator<UserEntity>() {
        @Override
        public UserEntity createFromParcel(Parcel in) {
            return new UserEntity(in);
        }

        @Override
        public UserEntity[] newArray(int size) {
            return new UserEntity[size];
        }
    };

    public Long get_id() {
        return this._id;
    }
    public void set_id(Long _id) {
        this._id = _id;
    }
    public int getUser_id() {
        return this.user_id;
    }
    public void setUser_id(int user_id) {
        this.user_id = user_id;
    }
    public int getUser_phone() {
        return this.user_phone;
    }
    public void setUser_phone(int user_phone) {
        this.user_phone = user_phone;
    }
    public String getUser_pwd() {
        return this.user_pwd;
    }
    public void setUser_pwd(String user_pwd) {
        this.user_pwd = user_pwd;
    }
    public String getUser_name() {
        return this.user_name;
    }
    public void setUser_name(String user_name) {
        this.user_name = user_name;
    }
    public String getUser_sex() {
        return this.user_sex;
    }
    public void setUser_sex(String user_sex) {
        this.user_sex = user_sex;
    }
    public String getUser_img() {
        return this.user_img;
    }
    public void setUser_img(String user_img) {
        this.user_img = user_img;
    }
    public int getUser_integral() {
        return this.user_integral;
    }
    public void setUser_integral(int user_integral) {
        this.user_integral = user_integral;
    }


    /**
     * Describe the kinds of special objects contained in this Parcelable
     * instance's marshaled representation. For example, if the object will
     * include a file descriptor in the output of {@link #writeToParcel(Parcel, int)},
     * the return value of this method must include the
     * {@link #CONTENTS_FILE_DESCRIPTOR} bit.
     *
     * @return a bitmask indicating the set of special object types marshaled
     * by this Parcelable object instance.
     */
    @Override
    public int describeContents() {
        return 0;
    }

    /**
     * Flatten this object in to a Parcel.
     *
     * @param dest  The Parcel in which the object should be written.
     * @param flags Additional flags about how the object should be written.
     *              May be 0 or {@link #PARCELABLE_WRITE_RETURN_VALUE}.
     */
    @Override
    public void writeToParcel(Parcel dest, int flags) {
        if (_id == null) {
            dest.writeByte((byte) 0);
        } else {
            dest.writeByte((byte) 1);
            dest.writeLong(_id);
        }
        dest.writeInt(user_id);
        dest.writeInt(user_phone);
        dest.writeString(user_pwd);
        dest.writeString(user_name);
        dest.writeString(user_sex);
        dest.writeString(user_img);
        dest.writeInt(user_integral);
    }
}

